import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PageRefreshindicatorEx extends StatefulWidget
{
  @override
  State<StatefulWidget> createState() {
    return _PageRefreshindicatorEx();
  }
}

class _PageRefreshindicatorEx extends State<PageRefreshindicatorEx>
{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('下拉刷新'),),
      body: RefreshIndicator(
        color: Colors.blue,
        displacement: 44.0,
        backgroundColor: Colors.grey[200],
        onRefresh: () async{
          await Future.delayed(Duration(milliseconds: 2000));
          return Future.value(true);
        },
        child: ListView.builder(itemBuilder: (BuildContext context, int index){
          return Container(
            height: 66,
            child: Text('测试数据 ${index}'),
          );
        },itemCount: 50,),
      ),
    );
  }
}